package com.ak.common.entity.system;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import com.ak.common.entity.BaseEntity;
import com.ak.common.utils.TimeConverter;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wuwenze.poi.annotation.Excel;
import com.wuwenze.poi.annotation.ExcelField;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author Vean
 */
@Data
@TableName("sys_user")
@Excel("用户信息表")
@EqualsAndHashCode(callSuper = false)
public class SystemUser extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -4352868070794165001L;

    // 默认头像
    public static final String DEFAULT_AVATAR = "default.jpg";
    // 默认密码
    public static final String DEFAULT_PASSWORD = "123456";

    /**
     * 用户 ID
     */
    @TableId(value = "user_id", type = IdType.UUID)
    private String userId;

    /**
     * 用户名
     */
    @Size(min = 4, max = 10, message = "{range}")
    @ExcelField(value = "用户名")
    private String username;

    /**
     * 密码
     */
    private String password;

    /**
     * 部门 ID
     */
    private Integer deptId;

    /**
     * 角色 ID
     */
    @NotBlank(message = "{required}")
    private String roleId;
    
    /**
     * 用户类型 0平台用户；1租户用户
     */
    private String userType;

    /**
     * 邮箱
     */
    @Size(max = 50, message = "{noMoreThan}")
    @Email(message = "{email}")
    @ExcelField(value = "邮箱")
    private String email;

    /**
     * 联系电话
     */
    @ExcelField(value = "联系电话")
    private String mobile;

    /**
     * 最近访问时间
     */
    @ExcelField(value = "最近访问时间", writeConverter = TimeConverter.class)
    private Date lastLoginTime;

    /**
     * 性别 0男 1女 2 保密
     */
    @NotBlank(message = "{required}")
    @ExcelField(value = "性别", writeConverterExp = "0=男,1=女,2=保密")
    private String sex;

    /**
     * 是否开启tab，0关闭 1开启
     */
    private char isTab;

    /**
     * 主题
     */
    private String theme;

    /**
     * 头像
     */
    private String avatar;


    private transient String deptName;
    private transient String roleName;
    private transient String dataScope;

    private transient String createTimeFrom;
    private transient String createTimeTo;

}
